# coding=utf-8

from socket import *

udp_socket = socket(AF_INET,SOCK_DGRAM)

send_data = 'i love you'

udp_addr = ('192.168.136.1',8080)

#发送消息
udp_socket.sendto(send_data.encode('gbk'),udp_addr)
#关闭套接字
# udp_socket.close()

#以下是接收消息内容
recv_data = udp_socket.recvfrom(1024) # 该行报错
print(recv_data)
print(recv_data[0].decode('gbk'))
print(recv_data[1])

udp_socket.close()